<template>
    <div>
        <div class="outer">
            <a-form :label-col="{span: 2}" :wrapper-col="{span: 14}">
				<div class="w-100 b-b m-b-30 m-t-20 font-20 padding-b-5">支付宝</div>
                <a-form-item label="商户号">
                    <a-input v-model:value="formData.aliPay.app_id"/>
                </a-form-item>
				<a-form-item label="公钥">
				    <a-input v-model:value="formData.aliPay.public_key"/>
				</a-form-item>
				<a-form-item label="私钥">
                    <a-input v-model:value="formData.aliPay.private_key"/>
                </a-form-item>
                <a-form-item label="异步通知地址">
                    <a-input v-model:value="formData.aliPay.notify_url"/>
                </a-form-item>
                <a-form-item label="同步通知地址">
                    <a-input v-model:value="formData.aliPay.return_url"/>
                </a-form-item>
				<a-form-item label="支付网关">
				    <a-input v-model:value="formData.aliPay.pay_url"/>
				</a-form-item>
				
				<div class="w-100" style="background-color: #f5f5f5;height: 5px;"></div>
				<div class="w-100 b-b m-b-30 m-t-20 font-20 padding-b-5">微信支付</div>
				<a-form-item label="商户号">
				    <a-input v-model:value="formData.nativePay.mch_id"/>
				</a-form-item>
                <a-form-item label="APPID">
                    <a-input v-model:value="formData.nativePay.appid"/>
                </a-form-item>
				<a-form-item label="key">
				    <a-input v-model:value="formData.nativePay.key"/>
				</a-form-item>
                <a-form-item label="回调地址">
                    <a-input v-model:value="formData.nativePay.notify_url"/>
                </a-form-item>
				<a-form-item label="支付地址">
				    <a-input v-model:value="formData.nativePay.url"/>
				</a-form-item>
				
				<div class="w-100" style="background-color: #f5f5f5;height: 5px;"></div>
				<div class="w-100 b-b m-b-30 m-t-20 font-20 padding-b-5">虎皮椒微信支付</div>
				<a-form-item label="APPID">
				    <a-input v-model:value="formData.hpjWxPay.appId"/>
				</a-form-item>
				<a-form-item label="appSecret">
				    <a-input v-model:value="formData.hpjWxPay.appSecret"/>
				</a-form-item>
				<a-form-item label="支付网关">
				    <a-input v-model:value="formData.hpjWxPay.url"/>
				</a-form-item>
				<a-form-item label="回调地址">
				    <a-input v-model:value="formData.hpjWxPay.notify_url"/>
				</a-form-item>
				<a-form-item label="网站域名">
				    <a-input v-model:value="formData.hpjWxPay.wap_url"/>
				</a-form-item>
				<a-form-item label="网站名称">
				    <a-input v-model:value="formData.hpjWxPay.wap_name"/>
				</a-form-item>
				<a-form-item :wrapper-col="{ span: 14, offset: 2 }">
				    <a-button  type="primary" @click="onSubmit">保存</a-button>
				</a-form-item>
            </a-form>
        </div>

    </div>
</template>
<script >
    import systemApi from '../../api/system.js'
  
    export default {
        data(){
            return{
                formData:{
                    nativePay:{
						url: 'https://api.mch.weixin.qq.com/pay/unifiedorder',
						notify_url: '',
						key: '',
						appid: '',
						mch_id: '',
					},
					aliPay:{
						pay_url: 'https://openapi.alipay.com/gateway.do',
						app_id: '',
						notify_url: '',
						return_url: '',
						public_key: '',
						private_key: ''
					},
					hpjWxPay:{
						appId: '',
						appSecret: '',
						url: '',
						notify_url: '',
						wap_url: '',
						wap_name: '',
					}
                }
            }
        },
        mounted() {
			this.getSystemConfig()
        },
        methods: {
            onSubmit() {
                systemApi.systemConfig(this.formData, 'pay').then(res => {
                	if(res.status == 1){
                		this.$message.success('修改成功')
                	}
                })
            },
			getSystemConfig(){
				systemApi.getSystemConfig('pay').then(res => {
					if(res.status == 1){
						this.formData = res.result
					}
				});
			}
        }
    }

</script>

<style scoped>
</style>
